home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / ObjCreate.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  35 lines

  1. ; Example 1
  2. ;
  3. ; Counting the number of open shell windows
  4.  
  5. $oShell = ObjCreate("shell.application")    ; Get the Windows Shell Object
  6. $oShellWindows=$oShell.windows            ; Get the collection of open shell Windows
  7.  
  8. if Isobj($oShellWindows) then
  9.  
  10.   $string=""                    ; String for displaying purposes
  11.  
  12.   for $Window in $oShellWindows          ; Count all existing shell windows
  13.     $String = $String & $Window.LocationName & @CRLF
  14.   next
  15.  
  16.   Msgbox(0,"Shell Windows","You have the following shell windows:" & @CRLF & @CRLF & $String);
  17.  
  18. endif
  19. exit
  20.  
  21.  
  22. ; Example 2
  23. ;
  24. ; Open the MediaPlayer on a REMOTE computer
  25. $oRemoteMedia = ObjCreate("MediaPlayer.MediaPlayer.1","name-of-remote-computer")
  26.  
  27. If not @error then
  28.     Msgbox(0,"Remote ObjCreate Test","ObjCreate() of a remote Mediaplayer Object successful !")
  29.     $oRemoteMedia.Open( @WindowsDir & "\media\Windows XP Startup.wav")        ; Play sound if file is present
  30. Else
  31.     Msgbox(0,"Remote ObjCreate Test","Failed to open remote Object. Error code: " & hex(@error,8))
  32. Endif
  33.  
  34.  
  35.